﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DBLayer;

namespace BALayer
{
    public class DBMonHoc
    {
        DAL db = null;
        public DBMonHoc()
        {
            db = new DAL();
        }
        //Lay Mon Hoc
        public DataSet LayMonHoc()
        {
            return db.ExecuteQueryDataSet("Select * From MonHoc", CommandType.Text, null);
        }
        //Them Mon Hoc
        public bool ThemMonHoc(ref string err, string MaMH, string TenMH)
        {
            return db.MyExecuteNonQuery("SpThemMonHoc", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaMH", MaMH),
                new SqlParameter("@TenMH", TenMH));
        }
        //Xoa Mon Hoc
        public bool XoaMonHoc(ref string err, string MaMH)
        {
            return db.MyExecuteNonQuery("SpXoaMonHoc", CommandType.StoredProcedure, ref err, new SqlParameter("@MaMH", MaMH));
        }
        //Cap nhat Mon Hoc
        public bool CapNhatMonHoc(ref string err, string MaMH, string TenMH)
        {
            return db.MyExecuteNonQuery("SpCapNhatMonHoc", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaMH", MaMH),
                new SqlParameter("@TenMH", TenMH));
        }
    }
}
